#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    
    // Connect navbar signals to mainwindow slots
    connect(ui->navBar, &Navbar::homeClicked, this, &MainWindow::switchToHome);
    connect(ui->navBar, &Navbar::msgClicked, this, &MainWindow::switchToMsg);
    connect(ui->navBar, &Navbar::friendsClicked, this, &MainWindow::switchToFriends);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::switchToHome()
{
    ui->stackedWidget->setCurrentWidget(ui->home);
}

void MainWindow::switchToMsg()
{
    ui->stackedWidget->setCurrentWidget(ui->msg);
}

void MainWindow::switchToFriends()
{
    ui->stackedWidget->setCurrentWidget(ui->friends);
}
